<template>
	<div>
		<van-nav-bar title="本月推广排名" />
		<van-list v-if="list.length>0"
		      v-model="list"
		      :finished="finished"
		      @load="onLoad"
		    >
		      <van-cell v-for="(item, index) in list" :key="index" :title="`第${index + 1}名：${item.name}`" :label="`推广人数：${item.inviteCount}`" />
		</van-list>
		<van-empty v-else>无推广数据</van-empty>
	</div>
</template>

<script type="ts">
export default {
 name: 'bmRank',
};
</script>
<script setup type="ts">
	import{ref,onMounted} from 'vue'
	import {bmRank} from '@/api/archives'
	
	const list = ref([]);
	    const loading = ref(false);
	    const finished = ref(false);
	    const refreshing = ref(false);
	
	    const onLoad = () => {
			if (refreshing.value) {
			  list.value = [];
			  refreshing.value = false;
			}
			bmRank()
			.then(ret=>{
				list.value=ret
				if(ret.currentPage==ret.totalPages)
				{
					finished.value = true;
				}
			})
			loading.value = false; 
	      
	    };
	
	    const onRefresh = () => {
	      // 清空列表数据
	      finished.value = false;
	
	      // 重新加载数据
	      // 将 loading 设置为 true，表示处于加载状态
	      loading.value = true;
	      onLoad();
	    };
		 
		onMounted(()=>{
		 
		})
</script>

<style>
</style>